# 使用 Python 3.9 的 slim 镜像 
FROM python:3.9-slim
 
# 设置环境变量 
ENV PYTHONUNBUFFERED=1 
ENV PIP_NO_CACHE_DIR=1 
ENV PIP_DISABLE_PIP_VERSION_CHECK=1 
 
# 设置工作目录 
WORKDIR /app 
 
# 创建必要的目录 
RUN mkdir -p /app/tmp/log /data/deploy/supervisor-demo /data/deploy/logs/supervisor 
 
# 切换到运行目录 
WORKDIR /data/deploy/supervisor-demo 
 
# 复制依赖文件和配置文件 
COPY requirements.txt  .
COPY deploy/supervisord.conf  /etc/supervisord.conf  
COPY deploy/supervisord.d/* /etc/supervisord.d/

 # 安装构建工具
 
# 安装 Python 依赖

RUN pip install --upgrade pip  -i https://mirrors.cloud.tencent.com/pypi/simple  && \
    pip install -r requirements.txt  -i https://mirrors.cloud.tencent.com/pypi/simple  
 
# 复制项目文件 
COPY . .
 
# 暴露端口 
EXPOSE 5555 
 
# 启动 Supervisor 和服务 
CMD ["/bin/bash", "-c", "/usr/bin/supervisorctl start ops_ExpoAICoreProcessor && while true; do sleep 10; done"]